// Created by Administrator on 2015/12/2.

extends ../public/pretty_layout
mixin active(_name, _path)
    if(_path == path)
        li.active: a(href='#{_path}') #{_name}
    else
        li: a(href='#{_path}') #{_name}
block content
    include header
    div.container
        nav.navbar.navbar-inverse(role="navigation" style="margin-bottom:0;margin-top:20px")
            div
                - var who = login_user && login_user.id === user.id ? '我的' : '他的'
                ul.nav.navbar-nav
                    + active(who + '菜谱', '/user/' + user.nick)
                    + active(who + '菜单', '/user/' + user.nick + '/menu')
                    - var collect_recipe_path = '/user/' + user.nick + '/collect/recipe'
                    - var collect_menu_path = '/user/' + user.nick + '/collect/menu'
                    if(path == collect_recipe_path || path == collect_menu_path)
                        li.dropdown.active
                            a.dropdown-toggle(href='javascript:;' data-toggle='dropdown') #{who}收藏
                                b.caret
                            ul.dropdown-menu
                                + active('菜谱收藏', collect_recipe_path)
                                li.divider
                                + active('菜单收藏', collect_menu_path)
                    else
                        li.dropdown
                            a.dropdown-toggle(href='javascript:;' data-toggle='dropdown') #{who}收藏
                                b.caret
                            ul.dropdown-menu
                                li: a(href='#{collect_recipe_path}') 菜谱收藏
                                li.divider
                                li: a(href='#{collect_menu_path}') 菜单收藏
                    + active(who + '粉丝', '/user/' + user.nick + '/fans')
                    + active(who + '关注', '/user/' + user.nick + '/consider')
                    if(login_user && login_user.id === user.id)
                        if(path == '/user/private/'+login_user.nick+'/message')
                            li.active: a(href='/user/private/#{login_user.nick}/message') 我的消息
                        else
                            li
                                a(href='/user/private/#{login_user.nick}/message') 我的消息
                                    if(login_user.msgCount)
                                        span.badge.pull-right #{login_user.msgCount}
        div.wrapper-content
            block person_menu_content